import Vue from 'vue'
import VueRouter from 'vue-router'
import layout from '../views/layout'


Vue.use(VueRouter)
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
const routes = [
  {
    path: '/',
    name: 'Layout',
    component: layout,
    children: [
      {
        path: '/',
        name: 'Home',
        component: () => import('../views/home'),
      },
      {
        path: 'strategy',
        name: 'Strategy',
        component: () => import('../views/strategy')
      },
      {
        path: 'find',
        name: 'Find',
        component: () => import('../views/find')
      },
      {
        path: 'friend',
        name: 'Friend',
        component: () => import('../views/friend')
      },
      {
        path: 'main',
        name: 'Main',
        component: () => import('../views/main')
      },
      {
        path: 'tuijian',
        name: 'Tuijian',
        component: () => import('../views/home/tuijian.vue'),
      }
    ]
  },
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
